package core

import (
	"github.com/gin-contrib/pprof"
	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
	"uss-root/middleware"
)

func GinServerStart() error {
	e := gin.Default()
	pprof.Register(e)
	e.Use(middleware.Counter())
	e.GET("/ws", WsServer)
	e.GET("/http", HttpServer)
	return e.Run(":8080")
}

func HttpServer(c *gin.Context) {
	l := make([]int8, viper.GetInt("size"))
	l[0] = 1
	c.JSON(200, gin.H{"code": 200})
}
